﻿using IOT4Week1Day1.App;
using IOT4Week1Day1.App.Dtos;
using IOT4Week1Day1.Domain.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using CSRedis;  //redis的客户端
using Common;

namespace IOT4Week1Day1.ApiHost.Controllers
{
    /// <summary>
    /// 系统设置模块
    /// </summary>
    [Route("api/[controller]/[action]")]  //配置路由
    [ApiController]
    public class SystemController : ControllerBase
    {
        private readonly IDictAppService _dictService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dictService"></param>
        public SystemController(IDictAppService dictService)
        {
            _dictService = dictService;
        }

        /// <summary>
        /// 获取数据字典
        /// </summary>
        /// <param name="dictName"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetDicts(string dictName)
        {
            var result = _dictService.GetDicts(dictName);

            return Ok(result);
        }
    }
}
